Android app, No error message but has stopped unexpectedly [migrated]

Posted by user74722 on Programmers See other posts from Programmers or by user74722
Published on 2012-12-10T05:18:42Z Indexed on 2012/12/10 11:23 UTC
Read the original article Hit count: 152

Filed under:
|
|

Does anyone know what is my problem. I do not have any compile error messages however when i run the app it crashes and stops unexpectedly.

Here is my codes. Thank you in advance.

ListView l ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_final_project);


        String  arr[]={"Red","Green","Blue","Yellow","Cyan"};
          l=(ListView) findViewById(R.id.listView1);
      ArrayAdapter<String> adapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, arr);
      l.setAdapter(adapter);


        Button buttonOne = (Button) findViewById(R.id.button1);
    buttonOne.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View v){

                setContentView(R.layout.layout_save);
            //  setContentView(R.layout.activity_final_project);    
            //startActivity(new Intent("com.example.finalproject.layout_save"));
            }
        });
        }

© Programmers or respective owner

Related posts about java

Related posts about object-oriented